<ion-modal-view class="page-wf">
  <ion-header-bar>
    <button class="button back-button buttons button-clear header-item" ng-click="modal.hide()">
      <span class="icon fs32 ion-ios-close-empty" style="margin-left: 10px"></span>
    </button>
    <h1 class="title">
      {{
        edittingRowIndex === -1 ? '添加一行' : '编辑第' + (edittingRowIndex + 1) + '行'
      }}
    </h1>
    <button class="button button-positive buttons button-clear header-item" ng-click="save()">
      保存
    </button>
  </ion-header-bar>

  <ion-content>
    <div class="list">
      <div class="item item-input item-indent wfic-{{ lvColtypes[colIndex] }}" ng-repeat="(colIndex, title) in lvTitles">
        <label class="input-label">{{ title }}</label>

        <!-- 单行文本 -->
        <input type="text" ng-if="lvColtypes[colIndex] === 'text'" ng-model="edittingRow[colIndex]">

        <!-- 多行文本 -->
        <div class="input-content" ng-if="lvColtypes[colIndex] === 'textarea'">
          <textarea ng-model="edittingRow[colIndex]" rows="3"></textarea>
        </div>
        
        <!-- 下拉选框 -->
        <div class="input-content" ng-if="lvColtypes[colIndex] === 'select'">
          <select ng-model="edittingRow[colIndex]" ng-options="item for item in splitValue(colIndex)"></select>
        </div>

        <!-- 单选 -->
        <div ng-if="lvColtypes[colIndex] === 'radio'">
          <label ng-repeat="radio in splitValue(colIndex)" class="checkbox">
            <input type="radio" ng-model="edittingRow[colIndex]" ng-value="radio" name="{{ title }}">
            {{ radio }}
          </label>
        </div>

        <!-- 复选 -->
        <ic-listview-checkbox ng-if="lvColtypes[colIndex] === 'checkbox'" ng-model="edittingRow[colIndex]" values="lvColvalues[colIndex]">
        </ic-listview-checkbox>

        <!-- 日期 -->
        <label ng-if="lvColtypes[colIndex] === 'date'">
          <input type="date" ng-model="edittingRow[colIndex]" date-str-input>
        </label>

        <!-- 计算 -->
        <span ng-if="lvColtypes[colIndex] === 'calc'">
          <span>{{ edittingRow[colIndex] }}</span>
          <ic-listview-calc ng-model="edittingRow[colIndex]" exp="lvColvalues[colIndex]" row-data="edittingRow"></ic-listview-calc>
        </span>

        <!-- <span>不支持的控件类型</span> -->
      </div>
    </div>
    <div class="padding" ng-if="edittingRowIndex !== -1">
      <button class="button button-block button-light" ng-click="removeRow()">删除此行</button>
    </div>
  </ion-content>
</ion-modal-view>